package com.gitee.feizns.itrip.personal.biz.entity.vo;

import com.gitee.feizns.itrip.personal.mapper.HotelOrderMapper;
import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author feizns
 * @since 2019/1/10 0010
 */
@Data
public class ForViewGetPersonalOrderInfo {

    private static final Map<String, String> IS_CANCEL_ORDER_PROCESS = new LinkedHashMap<>();

    private static final Map<String, String> ORDER_PROCESS = new LinkedHashMap<>();

    static {
        IS_CANCEL_ORDER_PROCESS.put("1", "订单提交");
        IS_CANCEL_ORDER_PROCESS.put("2", "订单支付");
        IS_CANCEL_ORDER_PROCESS.put("3", "订单取消");

        ORDER_PROCESS.put("1", "订单提交");
        ORDER_PROCESS.put("2", "订单支付");
        ORDER_PROCESS.put("3", "支付成功");
        ORDER_PROCESS.put("4", "入住");
        ORDER_PROCESS.put("5", "订单点评");
        ORDER_PROCESS.put("6", "已完成");
   }

    /**
     * 预订类型
     */
    private Integer bookType;

    /**
     * 创建日期
     */
    private Date creationDate;

    /**
     * 订单编号
     */
    private Integer id;

    /**
     * 通知手机号
     */
    private String noticePhone;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     *
     */
    private Map<String, String> orderProcess = ORDER_PROCESS;

    /**
     * 订单状态
     */
    private Integer orderStatus;

    /**
     * 付款金额
     */
    private Double payAmount;

    /**
     * 付款类型
     */
    private Integer payType;

    /**
     *
     */
    private String processNode;

    /**
     * 房间付款类型
     */
    private Integer roomPayType;

    public Map<String, String> getOrderProcess() {
        if ( orderStatus != null && orderStatus == HotelOrderMapper.ORDER_IS_CANCEL_STATUS )
            return IS_CANCEL_ORDER_PROCESS;
        return ORDER_PROCESS;
    }

    public static void main(String[] args) {
        System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(new Date("2019/01/02")));
    }

    //前端需求
    public String getProcessNode() {
        switch ( orderStatus ) {
            case HotelOrderMapper.ORDER_IS_CANCEL_STATUS : return "3";
            case HotelOrderMapper.ORDER_PENDING_PAYMENT_STATUS : return "1";
            case HotelOrderMapper.ORDER_PAYMENT_SUCCESSFUL_STATUS : return "3";
            case HotelOrderMapper.ORDER_ALREADY_CONSUMED_STATUS : return "5";
            case HotelOrderMapper.ORDER_REVIEWED_STATUS : return "6";
            default : return null;
        }
    }

}
